<template>
	<div class="control">
		<h4 class="control-title">图表参数控件</h4>
        <div class="control-items" >
            <label>高:<input type="text" :value="height" @change="updateHeight"></label>
            <label>宽:<input type="text" :value="width" @change="updateWidth"></label>
            <color class="color"></color>
            <button type="button" class="btn" >确认</button>
        </div>
	</div>
</template>

<script type="text/javascript">

import Vue from 'vue'
import color from './color.vue'

export default{
	data(){
		return{
            //width: '%',
            //height: '%',
        }
	},
	components:{
		color,
	},
	computed:{
		height () {
	      return this.$store.state.height
	    },
	    width () {
	      return this.$store.state.width
	    },
	},
	methods: {
	  	updateHeight (e) {
	    	this.$store.commit('updateHeight', e.target.value)
	  	},
	  	updateWidth (e) {
	    	this.$store.commit('updateWidth', e.target.value)
	  	}
	}
}
	
</script>

<style scoped lang="less">

/*控件样式*/

.control{
	height: 100%;
	.control-title{
		height: 50px;
		line-height: 50px;
		color: white;
		background-color: rgba(0,100,255,0.9);
	}
	.control-items{
		height: 100%;
		padding: 10px;
		label{
			color: #000;
			font-weight: 600;
			display: block;
			height: 40px;
			line-height: 40px;
			input{
				margin: 0 5px;
				padding: 0 5px;
				width: 50%;
				height: 25px;
			}
		}
		.btn{
			width: 70%;
			height: 28px;
			outline: none;
			border: 0;
			background-color: rgba(0,100,255,0.5);
			margin-top: 5px;
			cursor: pointer;
			color: #fff;
		}
		.color{
			width: 100%;
		}
	}
}

</style>